load(fullfile(matlabroot,'examples','signal','spots_num.mat'))

[pks,locs] = findpeaks(avSpots);

plot(year,avSpots,year(locs),pks,'or')
xlabel Year, ylabel Number, axis tight
[pks,locs] = findpeaks(avSpots,'MinPeakDistance',6);

plot(year,avSpots,year(locs),pks,'or')
xlabel Year, ylabel Number, title Sunspots, axis tight
legend('Data','peaks','location','NorthWest')

cycles = diff(locs); meanCycle = mean(cycles)